package com.jml.生命周期003;

import com.jml.生命周期003.config.MyConfig002;
import com.jml.生命周期003.config.MyConfig003;
import com.jml.生命周期003.config.MyConfig004;
import com.jml.生命周期003.config.MyConfig005;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

public class Test001 {
	
	public static void main(String[] args) {
		/**
		 * IOC容器初始化单例对象都是循环遍历调用getBean方法
		 */
		//AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext(MyConfig.class);

		//AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext(MyConfig001.class);
		
		//AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext(MyConfig002.class);
		
		AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext(MyConfig003.class);
		
		//AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext(MyConfig004.class);
		
		//AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext(MyConfig005.class);
		
		
		
		//applicationContext.getBean("");
	    /*
	    调用close方法时候才会销毁对象执行destroyMethod 方法,里面会对map方法进行clear
		也就是报错的时候就会执行close方法。
		*/
		applicationContext.close();
	}
	
	
}
